﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace Preferences {
    // Learn more about making custom code visible in the Xamarin.Forms previewer
    // by visiting https://aka.ms/xamarinforms-previewer
    [DesignTimeVisible(false)]
    public partial class MainPage : ContentPage {
        public MainPage() {
            InitializeComponent();
        }

        private void
            PreferenceSaveButton_OnClicked(object sender, EventArgs e) {
            Xamarin.Essentials.Preferences.Set("Capabilities.Preference.Key",
                PreferenceEntry.Text);
        }

        private void
            PreferenceReadButton_OnClicked(object sender, EventArgs e) {
            PreferenceResultLabel.Text =
                Xamarin.Essentials.Preferences.Get(
                    "Capabilities.Preference.Key", "No value");
        }
    }
}